﻿<%@ Page Language="C#" MasterPageFile="~/Shared/EOS.Master" AutoEventWireup="True"
    Inherits="EBAYVN.WEBADMIN.Forms.BaoCao.NghiepVu.BangThuChiTietCuaHopDong" CodeBehind="BangThuChiTietCuaHopDong.aspx.cs" %>

<%@ Import Namespace="EBAYVN.WEBADMIN.Common"%>
<%@ Import Namespace="EBAYVN.Util" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="EBAYVN.Controls" Namespace="EBAYVN.Controls" TagPrefix="EBAYVN" %>

<%@ Register assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>

<asp:Content ID="head" ContentPlaceHolderID="headCPH" runat="server"> 

    <script type="text/javascript">
        $(document).ready(function() {
            $(document).ready(function() {
            $("#divHopDong").dialog({
                    autoOpen: false,
                    modal: true,
                    minHeight: 100,
                    height: 'auto',
                    width: 'auto',
                    resizable: false,
                    open: function(event, ui) {
                    $(this).parent().appendTo("#divHopDongDlgContainer");
                    }
                });
            });
        });
        
    </script>
</asp:Content>
<asp:Content ID="content" ContentPlaceHolderID="ContentPlaceHolderMain" runat="server">
        <div id="divHopDongDlgContainer">
        <div id="divHopDong" style="display: none">
            <asp:UpdatePanel ID="upnlHopDong" runat="server" UpdateMode="Conditional">
				<ContentTemplate>
				    <table cellpadding="3" cellspacing="1" style="width: 800px;">
                        <tr>
                            <td class="crmcontainer">
                                <table class="crmtable">
                                    <tbody>
                                        <tr>
                                            <td class="crmcell right">
                                                Từ khóa
                                            </td>
                                            <td class="crmcell">
                                                <div class="left">
                                                    <EBAYVN:TextBox PostBackControlId="btnFilterHD" ID="txtKeywordHD" runat="server" Width="250px" MaxLength="200" />
                                                </div>
                                                <div class="left">
                                                    <EBAYVN:Button ID="btnFilterHD" OnClick="btnFilterHD_Click" UseSubmitBehavior="false"
                                                        runat="server" CssClass="filter" Text="" />
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
						<tr>
							<td class="ptop-10">
							    <div class="crmcontainer">
							       <EBAYVN:Grid ID="gvList" runat="server" OnRowCommand="gvList_RowCommand" UseCustomPager="true" PageSize="20">
                                        <PagerSettings FirstPageText="lịch trình" PageButtonCount="2" />
                                        <Columns>
                                            <asp:TemplateField HeaderStyle-Width="20%" HeaderText="Tên khách hàng">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="lnkBtnID" runat="server" CommandArgument='<%# Eval("MAHD") %>'
                                                        CommandName="EditItem" Text='<%# (Eval("KHACHHANG") != null) ? Eval("KHACHHANG.HOTEN") : " Chưa cập nhật"
                                                             %>'></asp:LinkButton>
                                                    
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderStyle-Width="10%" HeaderText="Điện thoại">
                                                <ItemTemplate>
                                                    <%# (Eval("KHACHHANG") != null) ? Eval("KHACHHANG.DIENTHOAI") : ""
                                                             %>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderStyle-Width="40%" HeaderText="Tên lịch trình">
                                                <ItemTemplate>
                                                    <%# (Eval("LICHTRINH") != null) ? Eval("LICHTRINH.TENLICHVC") : " Chưa cập nhật"
                                                             %>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderStyle-Width="10%" HeaderText="Số container">
                                                <ItemTemplate>
                                                    <%# (Eval("SOLUONGCT"))
                                                             %>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderStyle-Width="10%" HeaderText="Tiền">
                                                <ItemTemplate>
                                                             <%# string.Format("{0:0,0}", (Eval("SOTIEN")))
                                                             %>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderStyle-Width="10%" HeaderText="Tiền giảm">
                                                <ItemTemplate>
                                                    <%# string.Format("{0:0,0}", (Eval("TIENGIAM")))
                                                             %>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderStyle-Width="10%" HeaderText="Tinh Trạng">
                                                <ItemTemplate>
                                                    <%# Eval("TTHOPDONG").ToString().Equals(TTHOPDONG.HD_D.ToString()) ? "Còn nợ":
                                                        Eval("TTHOPDONG").ToString().Equals(TTHOPDONG.HD_E.ToString()) ? "Hết nợ" : "Chưa thanh toán" 
                                                             %>
                                                </ItemTemplate>
                                                <ItemStyle ForeColor="Red" Font-Bold="true" />
                                            </asp:TemplateField>
                                             <asp:TemplateField HeaderStyle-Width="10%" HeaderText="Loại hàng hóa">
                                                <ItemTemplate>
                                                    <%# (Eval("LOAIHANGHOA") != null) ? Eval("LOAIHANGHOA.TENHH") : " Khác"
                                                             %>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderStyle-Width="10%" HeaderText="A">
                                                <ItemTemplate>
                                                    <%# (Eval("DIADIEM") != null) ? Eval("DIADIEM.TENDIADIEM") : " Khác"
                                                             %>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            
                                            <asp:TemplateField HeaderStyle-Width="10%" HeaderText="B">
                                                <ItemTemplate>
                                                    <%# (Eval("DIADIEM1") != null) ? Eval("DIADIEM1.TENDIADIEM") : " Khác"
                                                             %>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderStyle-Width="10%" HeaderText="Ngày đăng kí">
                                                <ItemTemplate>
                                                    <%# (Eval("NGAYHD") != null) ?
                                                            String.Format("{0:dd/MM/yyyy}", Eval("NGAYHD"))
                                                            : "" %>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                   </EBAYVN:Grid>
                                </div>
							</td>
						</tr>
					</table>
				</ContentTemplate>
	        </asp:UpdatePanel>
        </div>
    </div>
        <div class="crmcontainer">
           <table class="crmtable">
        <tbody>
            <tr>
                <td class="crmcell right">Từ ngày</td>
                <td class="crmcell">    
                    <div class="left">
                        <asp:TextBox ID="txtTuNgay" tag="datevn" runat="server" Width="75px" />
                    </div>
                    <div class="left">
                        <div class="right">Đến ngày</div>
                    </div> 
                    <div class="left">
                        <asp:TextBox ID="txtDenNgay" tag="datevn" runat="server" Width="75px" Height="16px" />
                    </div>  
                </td>
            </tr>
            <tr>
                <td class="crmcell right">Người lập</td>
                <td class="crmcell">    
                    <div class="left">
                        <asp:TextBox ID="txtNguoiLap" runat="server" />
                    </div>
                    <div class="left">
                        <div class="right">Chọn hợp đồng</div>
                    </div> 
                    <div class="left">
                        <EBAYVN:TextBox runat="server" ID="txtMahd" PostBackControlId="btnBaoCao" />
                        <asp:Button runat="server" ID="btnBrowHD" OnClick="btnBrowHD_Click" CssClass="pickup" OnClientClick="openDialogAndBlock('Chọn từ danh sách hợp đồng', 1000, 'divHopDong')" />
                    </div> 
                </td>
            </tr>
            <tr>
                <td class="crmcell right"></td>
                <td class="crmcell">    
                    <div class="left">
                        <EBAYVN:Button ID="btnBaoCao" runat="server" onclick="btnBaoCao_Click" CssClass="report" />
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
    </div>
    <br />
    <div class="crmcontainer" id="divReport" runat="server">
        <CR:CrystalReportViewer ID="rpViewer" runat="server" DisplayGroupTree="False" PrintMode="ActiveX" AutoDataBind="true" />
    </div>
   
</asp:Content>
